<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layui</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="__static/lib/layui-v2.5.5/css/layui.css" media="all">
<link rel="stylesheet" href="__static/css/public.css" media="all">
<script src="__static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="__static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<style>
.layui-form-pane .layui-form-label {
	width: 90px;
}
</style>
</head>
<body style="    background: #fff;">
	<div class="">
		<div class="layuimini-main">
			<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
				<ul class="layui-tab-title">
					<li class="layui-this layui-col-xs6">支付宝账号</li>
					<li class="layui-col-xs6">个人银行卡</li>
					
				</ul>
				<div class="layui-tab-content" style="height: 100px;">
					<div class="layui-tab-item layui-show">
						<form class="layui-form " action="">
							<div class="layui-form-item">
								<label class="layui-form-label">*户名：</label>
								<div class="layui-col-xs8">
									<input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入真实姓名" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">*账号：</label>
								<div class="layui-col-xs8">
									<input type="text" name="number" lay-verify="required" autocomplete="off" placeholder="请输入支付宝账号" class="layui-input">
								</div>
							</div>
							<hr>
							<div class="layui-form-item">
								<div class="layui-input-block">
									<input type="hidden" name="type" value="1"  >
									<button class="layui-btn"  lay-submit="" lay-filter="demo1">添加</button>
								</div>
							</div>
						</form>
					</div>
					<div class="layui-tab-item">
						<form class="layui-form " action="">
							<div class="layui-form-item">
								<label class="layui-form-label">*户名：</label>
								<div class="layui-col-xs8">
									<input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入真实姓名" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">*卡号：</label>
								<div class="layui-col-xs8">
									<input type="number" name="number" lay-verify="required" autocomplete="off" placeholder="请输入收款人卡号" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">*银行名称：</label>
								<div class="layui-col-xs8">
									<input type="text" name="bank_name" lay-verify="required" autocomplete="off" placeholder="请输入银行名称" class="layui-input">
								</div>
							</div>
							<hr>
							<div class="layui-form-item">
								<div class="layui-input-block">
									<input type="hidden" name="type" value="2"  >
									<button class="layui-btn"  lay-submit="" lay-filter="demo2">添加</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
			
		</div>
	</div>
	
	<script>
		layui .use( [ 'form', 'table', 'element', 'laydate' ], function() {
			var $ = layui.jquery, form = layui.form, table = layui.table, laydate = layui.laydate,element = layui.element;
			//监听支付宝提交
			form.on('submit(demo1)', function(data){
				var articleFrom = data.field;
				layer.load(1, { shade : [ 0.5, '#676a6c' ] });
				$.post("{:url('add_user_account')}?t=json",articleFrom,function(data){
					layer.closeAll();
					if (data['code'] == 1) {
						var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
						parent.layer.close(index1); //再执行关闭 
						//父页面数据 ，重新加载
						parent.add_bx(data['msg']);

					} else {
						layer.msg(data['msg'], { icon : 5 });
					}
				});
				
				return false;
		  	});
			//监听银行卡提交
			form.on('submit(demo2)', function(data){
				var articleFrom = data.field;
				layer.load(1, { shade : [ 0.5, '#676a6c' ] });
				$.post("{:url('add_user_account')}?t=json",articleFrom,function(data){
					layer.closeAll();
					if (data['code'] == 1) {
						var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
						parent.layer.close(index1); //再执行关闭 
						//父页面数据 ，重新加载
						parent.add_bx(data['msg']);

					} else {
						layer.msg(data['msg'], { icon : 5 });
					}
				});
				
				return false;
		  	});

		});
	</script>

</body>
</html>